Function.prototype.myApply=function(context,...args){
    context=context||window
    const arg=args[0]
    if(!Array.isArray(arg)){
        throw new TypeError('CreateListFromArrayLike called on non-object')
    }
    const fn=Symbol('fn')
    context[fn]=this
    const res=context[fn](...arg)
    delete context[fn]
    return res


}
function foo(x,y){
    console.log(this.a,x+y);
    return 'hello'    
}
let obj={
    a:1
}
const result = foo.apply(obj, [1, 2]);
console.log(result); // 输出: 'hello